#include <stdio.h>

int main()
{
int g = 0;
int m = 8;
char ch = 0;
scanf("%d %c",&g,&ch);
if(g>1000)
{
    if((g-1000)%500 == 0)
    {
    	m+=(g-1000)/500*4;
	}
    else
        m+=((g-1000)/500+1)*4;
}	
if(ch == 'y')
{
	m+=5;
}
else if(ch == 'n')
{
	m = m+0;
}
printf("%d",m);
	
	return 0;
} 
